namespace QMVnSoft.ReportForms
{
    using QMVnSoft;
    using QMVnSoft.Controls;
    using QMVnSoft.DAL;
    using System;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Windows.Forms;

    public class FormKQT032Editor : FormListEditor
    {
        private ChkControl chkBold;
        private ChkControl chkIn_Ck;
        private IContainer components;
        private LabelControl lblCong_Thuc;
        private LabelControl lblDesc_EN;
        private LabelControl lblDien_Giai;
        private LabelControl lblIDKey;
        private LabelControl lblStt_Bac;
        private LabelControl lblStt0;
        private LabelControl lblTk_Co;
        private LabelControl lblTk_No;
        private LabelControl lblTMinh;
        private TextControl txtCong_Thuc;
        private TextControl txtDesc_EN;
        private TextControl txtDien_Giai;
        private TextNumeric txtIDKey;
        private TextNumeric txtStt_Bac;
        private TextControl txtStt0;
        private TextControl txtTk_Co;
        private TextControl txtTk_No;
        private TextControl txtTMinh;

        public FormKQT032Editor()
        {
            this.InitializeComponent();
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            //ComponentResourceManager manager = new ComponentResourceManager(typeof(FormKQT02Editor));
            this.txtStt0 = new TextControl();
            this.lblStt0 = new LabelControl();
            this.txtDien_Giai = new TextControl();
            this.lblDien_Giai = new LabelControl();
            this.txtDesc_EN = new TextControl();
            this.lblDesc_EN = new LabelControl();
            this.txtIDKey = new TextNumeric();
            this.lblIDKey = new LabelControl();
            this.txtCong_Thuc = new TextControl();
            this.lblCong_Thuc = new LabelControl();
            this.chkIn_Ck = new ChkControl();
            this.chkBold = new ChkControl();
            this.lblStt_Bac = new LabelControl();
            this.txtStt_Bac = new TextNumeric();
            this.lblTMinh = new LabelControl();
            this.txtTMinh = new TextControl();
            this.lblTk_No = new LabelControl();
            this.txtTk_No = new TextControl();
            this.txtTk_Co = new TextControl();
            this.lblTk_Co = new LabelControl();
            base.SuspendLayout();
            base.txtMa_Loai3.FirstFilter = "Type = ''";
            base.txtMa_Loai3.Location = new Point(0x18c, 0x146);
            base.txtMa_Loai3.Size = new Size(0x85, 20);
            base.txtMa_Loai3.TabIndex = 0x13;
            base.txtMa_Loai2.FirstFilter = "Type = ''";
            base.txtMa_Loai2.Location = new Point(0x103, 0x146);
            base.txtMa_Loai2.Size = new Size(0x86, 20);
            base.txtMa_Loai2.TabIndex = 0x12;
            base.txtMa_Loai1.FirstFilter = "Type = ''";
            base.txtMa_Loai1.Location = new Point(0x7b, 0x146);
            base.txtMa_Loai1.Size = new Size(0x85, 20);
            base.txtMa_Loai1.TabIndex = 0x11;
            base.lblPhan_Loai.Location = new Point(12, 0x149);
            this.txtStt0.CheckTextSearched = false;
            this.txtStt0.DisabledForeColor = Color.Empty;
            this.txtStt0.Font = new Font("Arial", 8.25f);
            this.txtStt0.Location = new Point(0x18c, 0x1c);
            this.txtStt0.MaxLength = 0x20;
            this.txtStt0.Name = "txtStt0";
            this.txtStt0.OldValue = null;
            this.txtStt0.Size = new Size(0x85, 20);
            this.txtStt0.TabIndex = 1;
            this.txtStt0.UserTextLength = AppInstance.TextControlLength.ItemCode;
            this.txtStt0.UserTrimMode = AppInstance.TextControlTrimMode.None;
//            this.txtStt0.Value = null;//manager.GetObject("txtStt0.Value");
            this.lblStt0.AutoSize = true;
            this.lblStt0.Font = new Font("Arial", 8.25f);
            this.lblStt0.Location = new Point(0x165, 0x1f);
            this.lblStt0.Name = "lblStt0";
            this.lblStt0.Size = new Size(0x24, 14);
            this.lblStt0.TabIndex = 4;
            this.lblStt0.Text = "Mã số";
            this.txtDien_Giai.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.txtDien_Giai.CheckTextSearched = false;
            this.txtDien_Giai.DisabledForeColor = Color.Empty;
            this.txtDien_Giai.Font = new Font("Arial", 8.25f);
            this.txtDien_Giai.Location = new Point(0x7b, 50);
            this.txtDien_Giai.MaxLength = 128;
            this.txtDien_Giai.Name = "txtDien_Giai";
            this.txtDien_Giai.OldValue = null;
            this.txtDien_Giai.Size = new Size(0x196, 20);
            this.txtDien_Giai.TabIndex = 2;
            this.txtDien_Giai.UserTextLength = AppInstance.TextControlLength.ItemDescription;
            this.txtDien_Giai.UserTrimMode = AppInstance.TextControlTrimMode.None;
//            this.txtDien_Giai.Value = null;//manager.GetObject("txtDien_Giai.Value");
            this.lblDien_Giai.AutoSize = true;
            this.lblDien_Giai.Font = new Font("Arial", 8.25f);
            this.lblDien_Giai.Location = new Point(12, 0x35);
            this.lblDien_Giai.Name = "lblDien_Giai";
            this.lblDien_Giai.Size = new Size(0x3e, 14);
            this.lblDien_Giai.TabIndex = 4;
            this.lblDien_Giai.Text = "Tên chỉ ti\x00eau";
            this.txtDesc_EN.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.txtDesc_EN.CheckTextSearched = false;
            this.txtDesc_EN.DisabledForeColor = Color.Empty;
            this.txtDesc_EN.Font = new Font("Arial", 8.25f);
            this.txtDesc_EN.Location = new Point(0x7b, 0x48);
            this.txtDesc_EN.MaxLength = 128;
            this.txtDesc_EN.Name = "txtDesc_EN";
            this.txtDesc_EN.OldValue = null;
            this.txtDesc_EN.Size = new Size(0x196, 20);
            this.txtDesc_EN.TabIndex = 3;
            this.txtDesc_EN.UserTextLength = AppInstance.TextControlLength.ItemDescription;
            this.txtDesc_EN.UserTrimMode = AppInstance.TextControlTrimMode.None;
//            this.txtDesc_EN.Value = null;//manager.GetObject("txtDesc_EN.Value");
            this.lblDesc_EN.AutoSize = true;
            this.lblDesc_EN.Font = new Font("Arial", 8.25f);
            this.lblDesc_EN.Location = new Point(12, 0x4b);
            this.lblDesc_EN.Name = "lblDesc_EN";
            this.lblDesc_EN.Size = new Size(0x6f, 14);
            this.lblDesc_EN.TabIndex = 4;
            this.lblDesc_EN.Text = "Tên chỉ ti\x00eau tiếng Anh";
            this.txtIDKey.Font = new Font("Arial", 8.25f);
            this.txtIDKey.Location = new Point(0x7b, 0x1c);
            this.txtIDKey.Name = "txtIDKey";
            this.txtIDKey.NumericScaleOnFocus = 0;
            this.txtIDKey.NumericScaleOnLostFocus = 0;
            int[] bits = new int[4];
            this.txtIDKey.NumericValue = new decimal(bits);
            this.txtIDKey.OldValue = null;
            this.txtIDKey.Size = new Size(0x85, 20);
            this.txtIDKey.TabIndex = 0;
            this.txtIDKey.TextAlign = HorizontalAlignment.Right;
//            this.txtIDKey.Value = null;//manager.GetObject("txtIDKey.Value");
            this.lblIDKey.AutoSize = true;
            this.lblIDKey.Font = new Font("Arial", 8.25f);
            this.lblIDKey.Location = new Point(12, 0x1f);
            this.lblIDKey.Name = "lblIDKey";
            this.lblIDKey.Size = new Size(0x34, 14);
            this.lblIDKey.TabIndex = 0x24;
            this.lblIDKey.Text = "Số thứ tự";
            this.txtCong_Thuc.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.txtCong_Thuc.CheckTextSearched = false;
            this.txtCong_Thuc.DisabledForeColor = Color.Empty;
            this.txtCong_Thuc.Font = new Font("Arial", 8.25f);
            this.txtCong_Thuc.Location = new Point(0x7b, 0x5e);
            this.txtCong_Thuc.MaxLength = 128;
            this.txtCong_Thuc.Name = "txtCong_Thuc";
            this.txtCong_Thuc.OldValue = null;
            this.txtCong_Thuc.Size = new Size(0x196, 20);
            this.txtCong_Thuc.TabIndex = 4;
            this.txtCong_Thuc.UserTextLength = AppInstance.TextControlLength.ItemDescription;
            this.txtCong_Thuc.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtCong_Thuc.Value = null;//manager.GetObject("txtCong_Thuc.Value");
            this.lblCong_Thuc.AutoSize = true;
            this.lblCong_Thuc.Font = new Font("Arial", 8.25f);
            this.lblCong_Thuc.Location = new Point(12, 0x61);
            this.lblCong_Thuc.Name = "lblCong_Thuc";
            this.lblCong_Thuc.Size = new Size(0x39, 14);
            this.lblCong_Thuc.TabIndex = 4;
            this.lblCong_Thuc.Text = "Công thức";
            this.chkIn_Ck.AutoSize = true;
            this.chkIn_Ck.Font = new Font("Arial", 8.25f);
            this.chkIn_Ck.Location = new Point(0x7b, 0xbc);
            this.chkIn_Ck.Name = "chkIn_Ck";
            this.chkIn_Ck.Size = new Size(0x22, 0x12);
            this.chkIn_Ck.TabIndex = 9;
            this.chkIn_Ck.Text = "In";
            this.chkIn_Ck.UseVisualStyleBackColor = true;
            this.chkBold.AutoSize = true;
            this.chkBold.Font = new Font("Arial", 8.25f);
            this.chkBold.Location = new Point(0x7b, 0xd4);
            this.chkBold.Name = "chkBold";
            this.chkBold.Size = new Size(0x39, 0x12);
            this.chkBold.TabIndex = 10;
            this.chkBold.Text = "In đậm";
            this.chkBold.UseVisualStyleBackColor = true;
            this.lblStt_Bac.AutoSize = true;
            this.lblStt_Bac.Font = new Font("Arial", 8.25f);
            this.lblStt_Bac.Location = new Point(12, 0xa3);
            this.lblStt_Bac.Name = "lblStt_Bac";
            this.lblStt_Bac.Size = new Size(0x3f, 14);
            this.lblStt_Bac.TabIndex = 0x24;
            this.lblStt_Bac.Text = "Bậc chỉ ti\x00eau";
            this.txtStt_Bac.Font = new Font("Arial", 8.25f);
            this.txtStt_Bac.Location = new Point(0x7b, 160);
            this.txtStt_Bac.Name = "txtStt_Bac";
            this.txtStt_Bac.NumericScaleOnFocus = 0;
            this.txtStt_Bac.NumericScaleOnLostFocus = 0;
            int[] numArray2 = new int[4];
            this.txtStt_Bac.NumericValue = new decimal(numArray2);
            this.txtStt_Bac.OldValue = null;
            this.txtStt_Bac.Size = new Size(0x85, 20);
            this.txtStt_Bac.TabIndex = 7;
            this.txtStt_Bac.TextAlign = HorizontalAlignment.Right;
//            this.txtStt_Bac.Value = null;//manager.GetObject("txtStt_Bac.Value");
            this.lblTMinh.AutoSize = true;
            this.lblTMinh.Font = new Font("Arial", 8.25f);
            this.lblTMinh.Location = new Point(0x148, 0xa3);
            this.lblTMinh.Name = "lblTMinh";
            this.lblTMinh.Size = new Size(0x41, 14);
            this.lblTMinh.TabIndex = 0x24;
            this.lblTMinh.Text = "Thuyết minh";
            this.txtTMinh.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.txtTMinh.CheckTextSearched = false;
            this.txtTMinh.DisabledForeColor = Color.Empty;
            this.txtTMinh.Font = new Font("Arial", 8.25f);
            this.txtTMinh.Location = new Point(0x18c, 160);
            this.txtTMinh.MaxLength = 20;
            this.txtTMinh.Name = "txtTMinh";
            this.txtTMinh.OldValue = null;
            this.txtTMinh.Size = new Size(0x85, 20);
            this.txtTMinh.TabIndex = 8;
            this.txtTMinh.UserTextLength = AppInstance.TextControlLength.InvoiceNumber;
            this.txtTMinh.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtTMinh.Value = null;//manager.GetObject("txtTMinh.Value");
            this.lblTk_No.AutoSize = true;
            this.lblTk_No.Font = new Font("Arial", 8.25f);
            this.lblTk_No.Location = new Point(12, 0x77);
            this.lblTk_No.Name = "lblTk_No";
            this.lblTk_No.Size = new Size(0x45, 14);
            this.lblTk_No.TabIndex = 4;
            this.lblTk_No.Text = "Tài khoản nợ";
            this.txtTk_No.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.txtTk_No.CheckTextSearched = false;
            this.txtTk_No.DisabledForeColor = Color.Empty;
            this.txtTk_No.Font = new Font("Arial", 8.25f);
            this.txtTk_No.Location = new Point(0x7b, 0x74);
            this.txtTk_No.MaxLength = 128;
            this.txtTk_No.Name = "txtTk_No";
            this.txtTk_No.OldValue = null;
            this.txtTk_No.Size = new Size(0x196, 20);
            this.txtTk_No.TabIndex = 5;
            this.txtTk_No.UserTextLength = AppInstance.TextControlLength.ItemDescription;
            this.txtTk_No.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtTk_No.Value = null;//manager.GetObject("txtTk_No.Value");
            this.txtTk_Co.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.txtTk_Co.CheckTextSearched = false;
            this.txtTk_Co.DisabledForeColor = Color.Empty;
            this.txtTk_Co.Font = new Font("Arial", 8.25f);
            this.txtTk_Co.Location = new Point(0x7b, 0x8a);
            this.txtTk_Co.MaxLength = 128;
            this.txtTk_Co.Name = "txtTk_Co";
            this.txtTk_Co.OldValue = null;
            this.txtTk_Co.Size = new Size(0x196, 20);
            this.txtTk_Co.TabIndex = 6;
            this.txtTk_Co.UserTextLength = AppInstance.TextControlLength.ItemDescription;
            this.txtTk_Co.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtTk_Co.Value = null;//manager.GetObject("txtTk_Co.Value");
            this.lblTk_Co.AutoSize = true;
            this.lblTk_Co.Font = new Font("Arial", 8.25f);
            this.lblTk_Co.Location = new Point(12, 0x8d);
            this.lblTk_Co.Name = "lblTk_Co";
            this.lblTk_Co.Size = new Size(0x44, 14);
            this.lblTk_Co.TabIndex = 4;
            this.lblTk_Co.Text = "Tài khoản có";
            base.AddTitleText = "Thêm chỉ ti\x00eau mới";
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.ClientSize = new Size(0x222, 360);
            base.Controls.Add(this.chkBold);
            base.Controls.Add(this.chkIn_Ck);
            base.Controls.Add(this.lblTMinh);
            base.Controls.Add(this.txtStt_Bac);
            base.Controls.Add(this.lblStt_Bac);
            base.Controls.Add(this.txtIDKey);
            base.Controls.Add(this.lblIDKey);
            base.Controls.Add(this.lblDesc_EN);
            base.Controls.Add(this.lblTk_Co);
            base.Controls.Add(this.lblTk_No);
            base.Controls.Add(this.lblCong_Thuc);
            base.Controls.Add(this.lblDien_Giai);
            base.Controls.Add(this.lblStt0);
            base.Controls.Add(this.txtTMinh);
            base.Controls.Add(this.txtTk_Co);
            base.Controls.Add(this.txtTk_No);
            base.Controls.Add(this.txtCong_Thuc);
            base.Controls.Add(this.txtDesc_EN);
            base.Controls.Add(this.txtDien_Giai);
            base.Controls.Add(this.txtStt0);
            base.EditTitleText = "Sửa chỉ ti\x00eau";
            base.FirstFreeCode = "";
            base.Name = "FormKQT02Editor";
            base.SecondFreeCode = "";
            base.ShowFreeFields = false;
            this.Text = "Thêm chỉ ti\x00eau mới";
            base.ThirdFreeCode = "";
            base.Controls.SetChildIndex(base.lblPhan_Loai, 0);
            base.Controls.SetChildIndex(base.txtMa_Loai1, 0);
            base.Controls.SetChildIndex(base.txtMa_Loai2, 0);
            base.Controls.SetChildIndex(base.txtMa_Loai3, 0);
            base.Controls.SetChildIndex(this.txtStt0, 0);
            base.Controls.SetChildIndex(this.txtDien_Giai, 0);
            base.Controls.SetChildIndex(this.txtDesc_EN, 0);
            base.Controls.SetChildIndex(this.txtCong_Thuc, 0);
            base.Controls.SetChildIndex(this.txtTk_No, 0);
            base.Controls.SetChildIndex(this.txtTk_Co, 0);
            base.Controls.SetChildIndex(this.txtTMinh, 0);
            base.Controls.SetChildIndex(this.lblStt0, 0);
            base.Controls.SetChildIndex(this.lblDien_Giai, 0);
            base.Controls.SetChildIndex(this.lblCong_Thuc, 0);
            base.Controls.SetChildIndex(this.lblTk_No, 0);
            base.Controls.SetChildIndex(this.lblTk_Co, 0);
            base.Controls.SetChildIndex(this.lblDesc_EN, 0);
            base.Controls.SetChildIndex(this.lblIDKey, 0);
            base.Controls.SetChildIndex(this.txtIDKey, 0);
            base.Controls.SetChildIndex(this.lblStt_Bac, 0);
            base.Controls.SetChildIndex(this.txtStt_Bac, 0);
            base.Controls.SetChildIndex(this.lblTMinh, 0);
            base.Controls.SetChildIndex(this.chkIn_Ck, 0);
            base.Controls.SetChildIndex(this.chkBold, 0);
            base.ResumeLayout(false);
            base.PerformLayout();
        }

        public override bool OnSave()
        {
            DataRow localCurrentRow;
            if (this.txtIDKey.NumericValue == 0M)
            {
                MessageBox.Show("Chưa nhập số thứ tự chỉ ti\x00eau!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (string.IsNullOrEmpty(this.txtDien_Giai.Text))
            {
                MessageBox.Show("Chưa nhập tên chỉ ti\x00eau!", AppInstance.SoftwareName, MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return false;
            }
            if (base.NewChecked)
            {
                localCurrentRow = base.LocalTable.NewRow();
            }
            else
            {
                localCurrentRow = base.LocalCurrentRow;
            }
            localCurrentRow["IDKey"] = this.txtIDKey.Value;
            localCurrentRow["Stt0"] = this.txtStt0.Value;
            localCurrentRow["Dien_Giai"] = this.txtDien_Giai.Value;
            localCurrentRow["Desc_EN"] = this.txtDesc_EN.Value;
            localCurrentRow["Cong_Thuc"] = this.txtCong_Thuc.Value;
            localCurrentRow["Tk_No"] = this.txtTk_No.Value;
            localCurrentRow["Tk_Co"] = this.txtTk_Co.Value;
            localCurrentRow["Stt_Bac"] = this.txtStt_Bac.Value;
            localCurrentRow["TMinh"] = this.txtTMinh.Value;
            localCurrentRow["In_Ck"] = this.chkIn_Ck.Checked;
            localCurrentRow["Bold"] = this.chkBold.Checked;
            ReportDeclarationDataAccess access = new ReportDeclarationDataAccess();
            if (base.ShowMessage(localCurrentRow, access.KQT032Save(base.NewChecked, localCurrentRow)))
            {
                return false;
            }
            if (base.NewChecked)
            {
                base.LocalTable.Rows.Add(localCurrentRow);
            }
            base.LocalCurrentRow = localCurrentRow;
            base.LocalTable.AcceptChanges();
            this.txtIDKey.Focus();
            return base.OnSave();
        }

        public override void OnShow()
        {
            this.txtIDKey.Value = base.LocalCurrentRow["IDKey"];
            this.txtStt0.Value = base.LocalCurrentRow["Stt0"];
            this.txtDien_Giai.Value = base.LocalCurrentRow["Dien_Giai"];
            this.txtDesc_EN.Value = base.LocalCurrentRow["Desc_EN"];
            this.txtCong_Thuc.Value = base.LocalCurrentRow["Cong_Thuc"];
            this.txtTk_No.Value = base.LocalCurrentRow["Tk_No"];
            this.txtTk_Co.Value = base.LocalCurrentRow["Tk_Co"];
            this.txtStt_Bac.Value = base.LocalCurrentRow["Stt_Bac"];
            this.txtTMinh.Value = base.LocalCurrentRow["TMinh"];
            this.chkIn_Ck.Checked = (bool) base.LocalCurrentRow["In_Ck"];
            this.chkBold.Checked = (bool) base.LocalCurrentRow["Bold"];
            base.OnShow();
        }
    }
}

